#!./perl

# ------------------------------------------------------------

# initdev.pl, by Jean-Pierre Girard (jpg@corrado.sun.com)
# This allows the development environment to choose what
# page to load depending on the existence of .cdev

# ------------------------------------------------------------

# Bugs and other fixes

# ------------------------------------------------------------
##############################################################################
# main
##############################################################################
$BASEDIR = $ENV{"DOCUMENT_ROOT"};
require 'devinfo.pl';
require 'tools.pl';

if ($ENV{'REQUEST_METHOD'} eq "POST") {
	read(STDIN, $request, $ENV{'CONTENT_LENGTH'});
} elsif ($ENV{'REQUEST_METHOD'} eq "GET" ) {
	$request = $ENV{'QUERY_STRING'};
}

$request =~ s/%(..)/pack("c",hex($1))/ge;
#print "request=$request<br>";
#print "ARGV0=$ARGV[0]<br>";
#if (@ARGV == 0 && $request eq "") {

if ($request eq "UPDATE") {
	system("cmdtool $BASEDIR/.bin/update.csh -all");
	#system("$BASEDIR/.bin/update.csh -prod>/dev/null");
	print "Location:  http://localhost:5759/CDware/index.html\n\n";
} else {
	$~ = HEADER;
	write;

	#print "<h4>\n<applet class=\"ImageLoopItem\" img=\"http://localhost:5759/DEV/images/blinkingAlert\" ALIGN=middle pause=5000 width=56 height=49>Don't forget to build the CDware files at least once!</h4><ul>";
	print "<h4>\n<img src=\"http://localhost:5759/DEV/images/finger.gif\" ALIGN=middle >You can come back to the main menu from your pages using the \"Goto\" menu: select <b>\"Catalyst CDware Developer's Kit - Main menu\"</h4><ul>";
	#print "<h4>\n<img=\"http://localhost:5759/DEV/images/finger\" ALIGN=middle >You can come back to the main menu from your pages using the \"Goto\" menu: select <b>\"Catalyst Developer's Kit: main menu\"</h4><ul>";
	print "<H2><IMG src=\"http://localhost:5759/DEV/images/bullet_ball_red.gif\"><a href=\"http://localhost:5759/cgi-bin/update.pl?UPDATE\">To build the CDware http://localhost:5759/httpd/.products/DEV/images/finger.gif\">This will create automatically HTML pages used for the CDware interface. You need to update this pages each time you changed some information on your company, if you want to see this changes taken into account.</ul></p>";
	if (-s "$BASEDIR/.categories/companies.html") {
		print "<H2><IMG src=\"http://localhost:5759/DEV/images/bullet_ball_red.gif\"><a href=\"http://localhost:5759/CDware/index.html\">To test your complete insertion</a></H2><br><ul><p><img ALIGN=middle src=\"http://localhost:5759/DEV/images/finger.gif\">Some features have been disabled (such as the catalog, or Help) but will be fully available in the version released to the customers.</ul>";
	}
	print "<h4><IMG src=\"http://localhost:5759/DEV/images/bullet_ball_red.gif\"><a href=\"http://localhost:5759/cgi-bin/mainmenu.pl?\">To go back to the main menu</a></h4><br>";

	$~ = FOOTER;
	write;
}

##############################################################################
# formats
##############################################################################
format HEADER =
Content-type: text/html


<html>
<title>Developer's Kit</title>
<body>
#<applet code=AnimatePLUS13.class width=150 height=65>
<applet class=AnimatePLUS13 width=150 height=65>
<param name=FRAMENAME value="comp">
<param name=NUMBER value=6>
<param name=RATE value=200>
<param name=BACKGROUND value=frames/background3>
<param name=CYCLES value="infinite">
<param name=PAUSE value=2000>
<param name=POSITIONDEFAULT value=(0)&(35)>
<param name=TRANSITIONS value=SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9>
<param name=BORDER value=3>
<param name=BORDERCOLOR value=0,0,225>
<param name=DIMENSIONS value=240,50>
</applet>
<CENTER><h1>CDware Developer's Kit</h1></CENTER>
.

format FOOTER =
</ul>
<p>
<hr>
<p>
You, like these companies, will benefit from the CDware capability of reaching tens of thousands of potential customers with information, links to your web site, or directly with YOUR product!
<p><applet class=ImageTape width=596 height=65 img_dir=../../../DEV/logos speed=10 dir=-10
url1=oracle
url2=progress
url3=gupta
url4=informix
url5=lotus
url6=ingres
>
</b>
<h5><p><A HREF=http://localhost:5759/CDware/Help/SMICopyright.html>Copyright</A> 1995 Sun Microsystems, Inc., 2550 Garcia Ave., Mtn. View, CA 94043 USA.  All rights reserved.</h5><br></pre>
<a href=http://localhost:5759/DEV/credits.html>Credits</a>
</b>
</form>
</body>
</html>
.

